<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>inherit圣杯模式</title>
</head>
<body>
<script>
    //圣杯模式：A继承B
    function inherit(Target,Origin) {
        function F() {
        }
        F.prototype = Origin.prototype;
        Target.prototype = new F();
        Target.prototype.constructor = Target;//让自己的constructor属于自己的
        Target.prototype.uber = Origin.prototype;//查询究竟继承谁
    }
    Father.prototype.lastName = "wei";
    function Father() {
    }
    function Son() {
    }
    inherit(Son,Father);
    var son = new Son();
    var father = new Father();
    console.log(son.lastName);
    console.log(father.lastName);
    Son.prototype.sex = "male";
    console.log(son.uber);
</script>

</body>
</html>
